package com.study.jmm;

public class VolatileDemo {
    static   boolean run = true;

    public static void main(String[] args) throws InterruptedException {
        Thread thread = new Thread(() -> {
            while (run) {
                //....
            }
        });
        thread.start();
        Thread.sleep(1000);
        run = false;
        System.out.println("end ==== ");
    }
}
